/*
* ECARX Technology Limited is the owner of the copyright and the trade secret of this software.
* Without permission, no one has the right to obtain, disclose or use this software in any way.
*/

package ecarx.xsf.notificationcenter.receiver;

import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.text.TextUtils;
import android.util.Log;

import ecarx.xsf.notificationcenter.ECarxNotificationListenerService;
import ecarx.xsf.notificationcenter.common.Constants;

/**
 * Created by lipeng
 * 接受激活服务的第一段广播，时机为开机引导广播延时10S发送
 * on 2021/11/25
 */
public class EASLaunchOneReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        if (!TextUtils.isEmpty(intent.getAction())
                && intent.getAction().equals(Constants.BroadcastAction.EAS_LAUNCH_ONE_ACTION)) {
            Log.i("EAS_LAUNCH_ONE_ACTION", "start service");
            Intent i = new Intent();
            i.setComponent(new ComponentName(context, ECarxNotificationListenerService.class));
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
                context.startService(i);
            } else {
                context.startService(i);
            }
        }
    }
}
